@using TestContentPackage
@using Microsoft.JSInterop

@inject IJSRuntime JSRuntime

<h1>Functionality and content from an external package</h1>

<p>
    NuGet packages can embed .NET code, which can in turn call Blazor's
    JS interop features if desired. This can be used to distribute new
    browser APIs as NuGet packages.
</p>

<p>Click the following button to invoke a JavaScript function.</p>

<button @onclick="ShowJavaScriptPrompt">Show JavaScript prompt</button>

@if (!string.IsNullOrEmpty(result))
{
    <p>Result: <strong>@result</strong></p>
}

<hr />

<p>
    Additionally, NuGet packages can contain Blazor components, and even
    static resources such as CSS files and images.
</p>

<ComponentFromPackage />

@code
{
    string result;

    async Task ShowJavaScriptPrompt()
    {
        result = await MyPrompt.Show(JSRuntime, "Hello!");
    }
}
